package threading;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: qian
 * Date: 2022-12-29
 * Time: 14:22
 */
public class Demo6 {
    private static boolean isQuite=false;
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
           while(!isQuite){
               System.out.println("hello thread");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
            System.out.println("t线程执行完了");
        });
        t.start();

        Thread.sleep(3000);
        isQuite=true;
        System.out.println("让t线程结束");
    }
}
